﻿using System;
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;

public class TweenAnimation : MonoBehaviour
{
	private DOTweenAnimation _tweenAnimation = null;
	private bool isShow = false;
	
	// Use this for initialization
	void Start ()
	{
		_tweenAnimation = GetComponent<DOTweenAnimation>();
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void OnClick()
	{
		if (isShow)
			_tweenAnimation.DOPlayBackwards();
		else
			_tweenAnimation.DOPlayForward();

		isShow = !isShow;
	}

	private void OnDestroy()
	{
		_tweenAnimation.DOKill();
	}
}
